const mysql = require('mysql');
const connection = mysql.createConnection({
    host: 'localhost',
    database: 'test',
    user: 'root'
});

const tableName = 'test_table';
connection.connect();

connection.query(`INSERT INTO ${tableName}(userId,name,gender) VALUES(?,?,?)`, ['123456', 'lll', Date.now().toString()], function (error, results) {
    if (error) throw error;
    console.log('The solution is: ', results);
});

connection.query(`SELECT * FROM ${tableName}`, function (error, results, fields) {
    if (error) throw error;
    console.log('The solution is: ', results);
});

connection.query(`SELECT * FROM ${tableName} WHERE gender LIKE "%5%"`, function (error, results) {
    if (error) throw error;
    console.log(`LIKE %5% results : ${results}`,results);
});

connection.query(`DELETE FROM ${tableName} WHERE gender < 5` ,function(error,results){
    if(error) throw error;
    console.log(`DELETE results : ${results}`);
});

connection.end();

